package com.service;

import java.util.List;

import com.dao.CommentDao;
import com.dao.IdeaDao;
import com.entity.Comment;
import com.entity.Idea;
import com.util.PageHelp;

public class IdeaService {
	
	private IdeaDao id=new IdeaDao();
	private CommentDao cd = new CommentDao();
	
	public PageHelp<Idea> findIdeaByPage(int pageNum) {
		PageHelp<Idea> page=new PageHelp<Idea>(10,id.getCount(),pageNum);
		return id.findByPage(page);
	}
	
	public void saveIdea(Idea i) {
		id.saveIdea(i);
		
	}
	
	public Idea findIdeaById(String ideaId) {
		return id.findIdeaById(ideaId);
	}
	
	public void updateById(Idea i,String ideaId) {
		id.updateById(i,ideaId);
	}
	
	public void delById(String ideaId) {
		id.delById(ideaId);
	}
	
	public void saveMsgFromIdea(Comment c) {
		cd.saveMsgFromIdea(c);
	}
	
	public List<Comment> findComment() {
		return cd.findMsgFromIdea();
	}
}
